<!-- 组件模板 -->
<div>
	<label for="">
		姓名{{name}}：
		<input type="text" v-model="txt">
		<span ref="span">{{txt}}</span>
		<button type="button" @click="doA">点我触发事件</button>
	</label>
</div>
<!-- 脚本 -->
<script>
	(function(){
		return {
			props:['name'],
			data: function(){
				return {
					name : "DD",
					txt: "尝试修改文本框内容..."
				}
			},
			mounted: function(){
				console.log(this);
				this.$refs.span.style.color = "blue";
				console.log(this.$refs == this.$vue.$refs);
			},
			methods: {
				doA: function(){
					layer.msg("bind methods in methods to vue component,<br> the txt is " + this.txt);
				}
			},
			created: function(){
				layer.msg("Hello Layer!");
			},
			require:['layer']
		}
	})()
</script>
<!-- 样式 -->
<style>
	input {
		color:red
	}
</style>